package patrol.mobile.com.mobilepatrol.adapter;

import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;

import java.util.List;

import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.activity.track.TrackDetailListActivity;
import patrol.mobile.com.mobilepatrol.bean.PatrolDetailInfoBean;
import patrol.mobile.com.mobilepatrol.manager.TrackManager;

/**
 * Created by long on 2016/8/24.
 * 巡道列表
 */
public class TrackListDetailAdapter extends BaseQuickAdapter<PatrolDetailInfoBean> {
    private TrackDetailListActivity context;
    public TrackListDetailAdapter(TrackDetailListActivity context, List<PatrolDetailInfoBean> data) {
        super(context, data);
        this.context =  context;
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_track_detail;
    }

    @Override
    protected void convert(final BaseViewHolder holder, final PatrolDetailInfoBean item) {
        holder.setText(R.id.index,item.index+"");
        holder.setText(R.id.tv1, TrackManager.getPatrol(item.patrolID).roadLine);
        holder.setText(R.id.tv2, "(K"+item.potMeter+"+"+item.pot+" - K"+item.endpotMeter+"+"+item.endpotKm+")");
//        holder.setText(R.id.tv3, "出现问题结束桩号："+item.endpotMeter+"+"+item.endpotKm);
        holder.setText(R.id.tv4, "巡道时间："+item.checkDate);
//        holder.setText(R.id.tv5, "巡道人 ："+TrackManager.getPatrol(item.patrolID).roader);
        holder.setText(R.id.tv6,"预判级别："+item.warnType);
//        holder.setText(R.id.tv7,"处置情况："+item.deal);

        //0没有上传
        if (item.statu==0){
            holder.setVisible(R.id.iv_up,false);
            holder.setVisible(R.id.iv_noup,false);
//            holder.getView(R.id.iv_noup).setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    context.upload(item.ID);
//                }
//            });
        }else{
            holder.setVisible(R.id.iv_up,true);
            holder.setVisible(R.id.iv_noup,false);

        }

    }
}
